package com.hl233.framework.controller;

import com.hl233.framework.pojo.User;
import com.hl233.framework.service.LoginService;
import com.hl233.framework.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 张振强15065206763
 * @create 2024-09-14
 */
@RestController
@RequestMapping("/sys")
public class LoginController {

    @Autowired
    private LoginService loginService;


    @PostMapping("/login")
    public Result login(@RequestParam("loginName") String loginName,@RequestParam("password") String password){
        User user = new User();
        user.setLoginName(loginName);
        user.setPassword(password);
        return loginService.login(user);
    }

    @DeleteMapping("/logout")
    public Result logout(){
        return loginService.logout();
    }

    @GetMapping("/getInfo")
    public Result getInfo(){
        return loginService.getInfo();
    }
}
